import random
import train
import my_utils
from ma_config import _Cell_decode,cell_node

in_channel = 16
out_channel = 16
kernel_size_s = 3
padding_s =1

kernel_size_l = 5
padding_l =2



def Performance_Estimation_Strategy(individual,Neural_nodes,epoch,_conv,_pool,is_save):
	nodes = []
	for i in range(Neural_nodes):
		if i % 2 == 0:
			node = cell_node(in_channel, out_channel, kernel_size_s, padding_s)
		else:
			node = cell_node(in_channel, out_channel, kernel_size_l, padding_l)
		# nodes.append(node.hidden_layer)
		nodes.append(node)

	result_nns,matrix_nodes = my_utils.decode_flow(individual, Neural_nodes,nodes,_conv,_pool)
	model = _Cell_decode(result_nns,matrix_nodes, nodes, _conv, _pool)
	print(model.parameters())
	result = train.start_model(model,epoch,is_save)
	
	return result['f1_score'][0]